`:top
`!Embedded SQL`! is a method of combining the `F33f`_`[computing`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Computing]`_`f power of a `F33f`_`[programming language`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Programming_language]`_`f and the `F33f`_`[database`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Database]`_`f `F33f`_`[manipulation`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Data_Manipulation_Language]`_`f capabilities of `F33f`_`[SQL`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=SQL]`_`f. Embedded SQL `F33f`_`[statements`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Statement_(programming)]`_`f are SQL statements written inline with the program `F33f`_`[source code`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Source_code]`_`f, of the host language. The embedded SQL statements are `F33f`_`[parsed`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Parsing]`_`f by an embedded SQL `F33f`_`[preprocessor`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Preprocessor]`_`f and replaced by host-language `F33f`_`[calls`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Call_site]`_`f to a code `F33f`_`[library`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Library_(computing)]`_`f. The output from the preprocessor is then compiled by the host `F33f`_`[compiler`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Compiler]`_`f. This allows programmers to embed SQL statements in programs written in any number of languages such as C/C++, `F33f`_`[COBOL`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=COBOL]`_`f and `F33f`_`[Fortran`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Fortran]`_`f. This differs from SQL-derived programming languages that don't go through discrete preprocessors, such as `F33f`_`[PL/SQL`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=PL/SQL]`_`f and `F33f`_`[T-SQL`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Transact-SQL]`_`f.
The SQL standards committee defined the embedded SQL standard in two steps: a formalism called `F33f`_`[Module Language`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Module_SQL]`_`f was defined, then the embedded SQL standard was derived from Module Language.`:cite-ref-modulelang-1-0[`F5bf`_`[1`#cite-note-modulelang-1]`_`f] The SQL standard defines embedding of SQL as `*embedded SQL`* and the language in which SQL queries are embedded is referred to as the `*host language`*. A popular host language is C. Host language C and embedded SQL, for example, is called `F33f`_`[Pro*C`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Pro*C]`_`f in `F33f`_`[Oracle`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Oracle_Database]`_`f and `F33f`_`[Sybase`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Sybase]`_`f database management systems, ESQL/C in `F33f`_`[Informix`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Informix]`_`f, and `F33f`_`[ECPG`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=ECPG]`_`f in the `F33f`_`[PostgreSQL`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=PostgreSQL]`_`f database management system. SQL may also be embedded in languages like PHP etc.
The SQL standard `F33f`_`[SQL:2023`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=SQL:2023]`_`f is available through purchase and contains chapter `!21 Embedded SQL`! and its syntax rules.`:cite-ref-2[`F5bf`_`[2`#cite-note-2]`_`f]
>>Contents
• `F0af`_`[Database systems that support embedded SQL`#database-systems-that-support-embedded-sql]`_`f
• `F0af`_`[Altibase`#altibase]`_`f
• `F0af`_`[IBM Db2`#ibm-db2]`_`f
• `F0af`_`[IBM Informix`#ibm-informix]`_`f
• `F0af`_`[Microsoft SQL Server`#microsoft-sql-server]`_`f
• `F0af`_`[Mimer SQL`#mimer-sql]`_`f
• `F0af`_`[Oracle Database`#oracle-database]`_`f
• `F0af`_`[PostgreSQL`#postgresql]`_`f
• `F0af`_`[SAP Sybase`#sap-sybase]`_`f
• `F0af`_`[Embedded SQL through domain-specific languages`#embedded-sql-through-domain-specific-languages]`_`f
• `F0af`_`[See also`#see-also]`_`f
• `F0af`_`[References`#references]`_`f
• `F0af`_`[External links`#external-links]`_`f
-─
>>Database systems that support embedded SQL
>>>Altibase
`!C/C++`!
APRE is an embedded SQL precompiler provided by `F33f`_`[Altibase`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Altibase]`_`f Corp. for its DBMS server.
>>>IBM Db2
`F33f`_`[IBM Db2`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=IBM_Db2]`_`f for Linux, UNIX and Windows supports embedded SQL for C, C++, Java, COBOL, FORTRAN and REXX although support for FORTRAN and REXX has been deprecated.`:cite-ref-3[`F5bf`_`[3`#cite-note-3]`_`f]
>>>IBM Informix
`F33f`_`[IBM Informix`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=IBM_Informix]`_`f version 14.10 for Linux, Unix, and Windows supports embedded SQL for C. `:cite-ref-4[`F5bf`_`[4`#cite-note-4]`_`f]}
>>>Microsoft SQL Server
`!C/C++`!
Embedded SQL for C has been deprecated as of `F33f`_`[Microsoft SQL Server`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Microsoft_SQL_Server]`_`f 2008 although earlier versions of the product support it.`:cite-ref-5[`F5bf`_`[5`#cite-note-5]`_`f]
>>>Mimer SQL
`F33f`_`[Mimer SQL`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Mimer_SQL]`_`f for Linux, `F33f`_`[macOS`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=MacOS]`_`f, `F33f`_`[OpenVMS`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=OpenVMS]`_`f and Windows support embedded SQL.`:cite-ref-6[`F5bf`_`[6`#cite-note-6]`_`f]
`!C/C++`!
Embedded SQL for C/C++ is supported on Linux, macOS, OpenVMS and Windows.
`!COBOL`!
Embedded SQL for COBOL is supported on OpenVMS.
`!Fortran`!
Embedded SQL for Fortran is supported on OpenVMS.
>>>Oracle Database
`!`F33f`_`[Ada`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Ada_(programming_language)]`_`f`!
Pro*Ada was officially desupported by `F33f`_`[Oracle`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Oracle_Corporation]`_`f in version 7.3. Starting with Oracle8, Pro*Ada was replaced by SQL*Module but appears to have not been updated since.`:cite-ref-7[`F5bf`_`[7`#cite-note-7]`_`f] SQL*Module is a module language that offers a different programming method from embedded SQL. SQL*Module supports the Ada83 language standard for Ada.
`!C/C++`!
`F33f`_`[Pro*C`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Pro*C]`_`f became Pro*C/C++ with Oracle8. Pro*C/C++ is currently supported as of Oracle Database 11`*g`*.
`!COBOL`!
Pro*COBOL is currently supported as of Oracle Database 11`*g`*.
`!Fortran`!
Pro*FORTRAN is no longer updated as of Oracle8 but Oracle will continue to issue patch releases as bugs are reported and corrected.`:cite-ref-langalts-8-0[`F5bf`_`[8`#cite-note-langalts-8]`_`f]
`!`F33f`_`[Pascal`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Pascal_(programming_language)]`_`f`!
Pro*Pascal was not released with Oracle8.`:cite-ref-langalts-8-1[`F5bf`_`[8`#cite-note-langalts-8]`_`f]
`!`F33f`_`[PL/I`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=PL/I]`_`f`!
Pro*PL/I was not released with Oracle8. The `*Pro*PL/I Supplement to the Oracle Precompilers Guide`*, however, continued to make appearances in the Oracle Documentation Library until release 11`*g`*. As of release 12c, the Pro*PL/I has been removed from the Oracle Documentation Library.`:cite-ref-langalts-8-2[`F5bf`_`[8`#cite-note-langalts-8]`_`f]
>>>PostgreSQL
`!C/C++`!
`F33f`_`[ECPG`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=ECPG]`_`f is part of `F33f`_`[PostgreSQL`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=PostgreSQL]`_`f since version 6.3.
`!COBOL`!
Cobol-IT is now distributing a COBOL precompiler for PostgreSQL
Micro Focus provides support via their OpenESQL preprocessor
>>>SAP Sybase
SAP Sybase ASE 15.7 supports embedded SQL for C and COBOL as part of the Software Developer Kit `F33f`_`[Sybase`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Sybase]`_`f.`:cite-ref-9[`F5bf`_`[9`#cite-note-9]`_`f]
SAP Sybase SQL Anywhere supports embedded SQL for C and C++ as part of the SQL Anywhere database management system `F33f`_`[SQL Anywhere`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=SQL_Anywhere]`_`f.`:cite-ref-10[`F5bf`_`[10`#cite-note-10]`_`f]
SAP Sybase IQ supports embedded SQL for C and C++ as part of the Sybase IQ database management system `F33f`_`[Sybase IQ`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Sybase_IQ]`_`f.`:cite-ref-11[`F5bf`_`[11`#cite-note-11]`_`f]
>>Embedded SQL through domain-specific languages
• `F33f`_`[LINQ-to-SQL`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Language_Integrated_Query]`_`f embeds a SQL-like language into `F33f`_`[.NET languages`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=List_of_CLI_languages]`_`f.
• `F33f`_`[JPA`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Java_Persistence_API]`_`f embeds a SQL-like language through Criteria API into `F33f`_`[Java`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Java_(programming_language)]`_`f.
• `F33f`_`[jOOQ`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Java_Object_Oriented_Querying]`_`f embeds a SQL-like language into `F33f`_`[Java`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Java_(programming_language)]`_`f.
>>See also
• `F33f`_`[Language binding`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Language_binding]`_`f
• `F33f`_`[Module SQL`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Module_SQL]`_`f
• `F33f`_`[PL/SQL`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=PL/SQL]`_`f
• `F33f`_`[Pro*C/C++`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Pro*C/C++]`_`f
• `F33f`_`[SQL/OLB`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=SQL/OLB]`_`f
• `F33f`_`[SQL PL`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=SQL_PL]`_`f
• `F33f`_`[Transact-SQL`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Transact-SQL]`_`f
>>References
`:cite-note-modulelang-1`!1.`! `F0af`_`[↑`#cite-ref-modulelang-1-0]`_`f "The Module Language Concept". `*SQL*Module for Ada Programmer's Guide, Release 8.0, Chapter 1. Introduction to SQL*Module`*. `F33f`_`[Oracle Corporation`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Oracle_Corporation]`_`f. Retrieved 2008-07-14.
`:cite-note-2`!2.`! `F0af`_`[↑`#cite-ref-2]`_`f "SQL Standard 2023 Chapter 21 Embedded SQL". `*ISO/IEC 9075-2:2023 Information technology — Database languages — SQL — Part 2: Foundation (SQL/Foundation)`*. `F33f`_`[ISO`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=ISO]`_`f. Retrieved 2023-08-17.
`:cite-note-3`!3.`! `F0af`_`[↑`#cite-ref-3]`_`f "DB2 Database for Linux, UNIX and Windows". `*Developing Embedded SQL Applications`*. `F33f`_`[IBM`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=IBM]`_`f. Retrieved 2009-04-10.
`:cite-note-4`!4.`! `F0af`_`[↑`#cite-ref-4]`_`f "Informix Dynamic Server". `*IBM® Informix® ESQL/C`*. `F33f`_`[IBM`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=IBM]`_`f. Retrieved 2020-03-31.
`:cite-note-5`!5.`! `F0af`_`[↑`#cite-ref-5]`_`f "Deprecated Database Engine Features in SQL Server 2008". `*SQL Server 2008 Books Online (March 2009)`*. `F33f`_`[Microsoft`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Microsoft]`_`f. Retrieved 2009-04-10.
`:cite-note-6`!6.`! `F0af`_`[↑`#cite-ref-6]`_`f "Embedded SQL". `*Mimer SQL Programmer's Manual latest version, Embedded SQL`*. `F33f`_`[Mimer SQL`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Mimer_SQL]`_`f.
`:cite-note-7`!7.`! `F0af`_`[↑`#cite-ref-7]`_`f "Ada Support in Version 8". `*Oracle9i Database Migration, Release 2 (9.2), Chapter 5. Compatibility and Interoperability`*. Oracle Corporation. Retrieved 2008-07-14.
`:cite-note-langalts-8`!8.`! `F0af`_`[↑`#cite-ref-langalts-8-0]`_`f "Language Alternatives". `*Pro*COBOL Precompiler Programmer's Guide, Release 8.0, Chapter 1. Introduction`*. Oracle Corporation. Retrieved 2008-07-14.
`:cite-note-9`!9.`! `F0af`_`[↑`#cite-ref-9]`_`f "EmbeddedSQL". `*SAP Sybase Products`*. SAP Sybase. Archived from the original on 2009-10-23. Retrieved 2012-09-05.
`:cite-note-10`!10.`! `F0af`_`[↑`#cite-ref-10]`_`f "SAP Sybase SQL Anywhere". `*SAP Sybase Products`*. SAP Sybase. Archived from the original on 2013-05-01. Retrieved 2013-05-02.
`:cite-note-11`!11.`! `F0af`_`[↑`#cite-ref-11]`_`f "SAP Sybase IQ". `*SAP Sybase Products`*. SAP Sybase. Archived from the original on 2013-05-04. Retrieved 2013-05-02.
>>External links
• Introduction to Pro*C Embedded SQL
• Embedded SQL with Pro*C
• SQL*Module for Ada Programmer's Guide, Release 8.0
• ECPG, PostgreSQL Documentation
• ESQL/C, Informix Documentation'
• Embedded SQL in C, Mimer SQL Developer
`c`F0af`_`[↑ Back to top`#top]`_`f`a